<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>人民币美元转换</title>
  <script src="https://cdn.jsdelivr.net/npm/vue@3.2.38/dist/vue.global.min.js"></script>
  <style>
  </style>
</head>

<body>
  <div id="app">
    <div>￥: <input type="number" v-model="cny"></div>
    <div>＄: <input type="text" v-model="dollar"></div>
    <p>{{cny}}人民币 = {{dollar.toFixed(2)}} 美元</p>

  </div>
</body>
<script>
  Vue.createApp({
    data() {
      return {
        cny: 0,
        dollar: 0
      }
    },
    watch: {
      cny(newValue, oldValue) {
        this.dollar = this.cny * 0.14237019
      }
    },
  }).mount('#app')
</script>

</html>